<!-- $Id: shop_config.htm 16865 2009-12-10 06:05:32Z sxc_shop $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,../js/region.js"}
<div class="tab-div">
  <!-- tab bar -->
  <div id="tabbar-div">
    <p>
      <span id="shop_info-tab_edit" class="tab-front">Banner设置</span>
      <span id="shop_info-tab_add" class="tab-back">添加Banner</span>
    </p>
  </div>
  <!-- tab body -->
  <div id="tabbody-div">
      <div id="edit_banner">
    <form  name="theForm" action="?act=post_edit_banner" method="post">
        <table class="shop_info-table" width="90%">
            <tr>
                <td>ID</td>
                <td>图片</td>
                <td>标题</td>
                <td>内容</td>
                <td>操作</td>
            </tr>
            {foreach from=$banners item=banners}
            <tr>
                <td>{$banners.id}</td>
                <td><input type="text" name="img_{$banners.id}" value="{$banners.img}"/> <input style="display:none;" type="text" name="banner_id[]" value="{$banners.id}"/></td>
                <td><input type="text" name="title_{$banners.id}" value="{$banners.title}"/></td>
                <td><input type="text" name="content_{$banners.id}" value="{$banners.content}"/></td>
                <td>
                    <input name="submit" type="button" value="删除" class="remove_banner" rel="{$banners.id}" />
                </td>
            </tr>
            {/foreach}
            
        </table>
    <div class="button-div">
        {if $update_ext eq 1}
        <div style="color: red;">修改成功</div>
        {/if}
      <input name="submit" type="submit" value="{$lang.button_submit}" class="button" />
      <input name="reset" type="reset" value="{$lang.button_reset}" class="button" />
    </div>
    </form>
    </div>
      <div id="add_banner" style="display:none;">
          <form  name="theForm" action="?act=add_banner" method="post">
            <table class="shop_info-table" width="90%">
                <tr>
                    <td>图片地址</td>
                    <td><input type="text" name="img" id="img"/></td>
                </tr>
                <tr>
                    <td>标题</td>
                    <td><input type="text" name="title" id="title"/></td>
                </tr>
                <tr>
                    <td>内容</td>
                    <td>
                        <textarea name="content" id="content"></textarea>
                    </td>
                </tr>
            </table>
        <div class="button-div">
          <input name="submit" type="submit" value="{$lang.button_submit}" class="button" id="add_banner_btn" />
        </div>
        </form>
      </div>
  </div>
</div>
{insert_scripts files="jquery.js,validator.js"}
{literal}
<script language="JavaScript">
    $(document).ready(function(){
       // 点击关闭的Tab
       $("#shop_info-tab_add").click(function(){
            $("#shop_info-tab_edit").attr("class","tab-back");
            $(this).attr("class","tab-front");
            $('#edit_banner').hide();
            $('#add_banner').show();
       });
       $("#shop_info-tab_edit").click(function(){
            $("#shop_info-tab_add").attr("class","tab-front");
            $(this).attr("class","tab-back");
            $('#edit_banner').show();
            $('#add_banner').hide();
       });
       $('#add_banner_btn').click(function(){
          if($("#img").val() == ''){
              alert("请输入图片地址");
              return false;
          }
          return true;
       });
       
       // 删除banner
       $(".remove_banner").click(function(){
           var id = $(this).attr('rel');
           if(id == ''){
               alert("错误");
               return false;
           }
           if(confirm("您确认要删除这条Banner么?")){
               window.location.href="?act=remve_banner&id="+id;
           }
       });
    });
</script>
{/literal}
{include file="pagefooter.htm"}